<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Module: Origami::Encryption::EncryptedDocument</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Module</strong></td>
          <td class="class-name-in-header">Origami::Encryption::EncryptedDocument</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../../files/origami/encryption_rb.html">
                origami/encryption.rb
                </a>
        <br />
            </td>
        </tr>

        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">



   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000261">physicalize</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





    <div id="attribute-list">
      <h3 class="section-bar">Attributes</h3>

      <div class="name-list">
        <table>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">encryption_dict</td>
          <td class="context-item-value">&nbsp;[W]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">encryption_key</td>
          <td class="context-item-value">&nbsp;[W]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">stm_algo</td>
          <td class="context-item-value">&nbsp;[W]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">str_algo</td>
          <td class="context-item-value">&nbsp;[W]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        </table>
      </div>
    </div>
      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000261" class="method-detail">
        <a name="M000261"></a>

        <div class="method-heading">
          <a href="#M000261" class="method-signature">
          <span class="method-name">physicalize</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000261-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000261-source">
<pre>
     <span class="ruby-comment cmt"># File origami/encryption.rb, line 278</span>
278:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">physicalize</span>
279: 
280:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">build</span>(<span class="ruby-identifier">obj</span>, <span class="ruby-identifier">revision</span>, <span class="ruby-identifier">embedded</span> = <span class="ruby-keyword kw">false</span>) <span class="ruby-comment cmt">#:nodoc:</span>
281:      
282:           <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">ObjectStream</span>)
283:             <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">subobj</span><span class="ruby-operator">|</span>
284:               <span class="ruby-identifier">build</span>(<span class="ruby-identifier">subobj</span>, <span class="ruby-identifier">revision</span>, <span class="ruby-keyword kw">true</span>)
285:             }
286:           <span class="ruby-keyword kw">end</span>
287: 
288:           <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">pre_build</span>
289: 
290:           <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">obj</span>
291:           <span class="ruby-keyword kw">when</span> <span class="ruby-constant">String</span>
292:             <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">equal?</span>(<span class="ruby-ivar">@encryption_dict</span>[<span class="ruby-identifier">:U</span>]) <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">equal?</span>(<span class="ruby-ivar">@encryption_dict</span>[<span class="ruby-identifier">:O</span>]) <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">embedded</span> 
293:               <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">extend</span>(<span class="ruby-constant">EncryptedString</span>)
294:               <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">decrypted</span> = <span class="ruby-keyword kw">true</span>
295:               <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">encryption_key</span> = <span class="ruby-ivar">@encryption_key</span>
296:               <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">algorithm</span> = <span class="ruby-ivar">@str_algo</span>
297:             <span class="ruby-keyword kw">end</span>
298: 
299:           <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Stream</span>
300:             <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">extend</span>(<span class="ruby-constant">EncryptedStream</span>)
301:             <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">decrypted</span> = <span class="ruby-keyword kw">true</span>
302:             <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">encryption_key</span> = <span class="ruby-ivar">@encryption_key</span>
303:             <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">algorithm</span> = <span class="ruby-ivar">@stm_algo</span>
304: 
305:           <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Dictionary</span>, <span class="ruby-constant">Array</span>
306: 
307:               <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">map!</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">subobj</span><span class="ruby-operator">|</span>
308:                 <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">subobj</span>.<span class="ruby-identifier">is_indirect?</span>
309:                   <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">get_object</span>(<span class="ruby-identifier">subobj</span>.<span class="ruby-identifier">reference</span>)
310:                     <span class="ruby-identifier">subobj</span>.<span class="ruby-identifier">reference</span>
311:                   <span class="ruby-keyword kw">else</span>
312:                     <span class="ruby-identifier">ref</span> = <span class="ruby-identifier">add_to_revision</span>(<span class="ruby-identifier">subobj</span>, <span class="ruby-identifier">revision</span>)
313:                     <span class="ruby-identifier">build</span>(<span class="ruby-identifier">subobj</span>, <span class="ruby-identifier">revision</span>, <span class="ruby-identifier">embedded</span>)
314:                     <span class="ruby-identifier">ref</span>
315:                   <span class="ruby-keyword kw">end</span>
316:                 <span class="ruby-keyword kw">else</span>
317:                   <span class="ruby-identifier">subobj</span>
318:                 <span class="ruby-keyword kw">end</span>
319:               }
320:               
321:               <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">subobj</span><span class="ruby-operator">|</span>
322:                 <span class="ruby-identifier">build</span>(<span class="ruby-identifier">subobj</span>, <span class="ruby-identifier">revision</span>, <span class="ruby-identifier">embedded</span>)
323:               }    
324:           <span class="ruby-keyword kw">end</span>
325: 
326:           <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">post_build</span>
327:           
328:         <span class="ruby-keyword kw">end</span>
329:        
330:         <span class="ruby-identifier">all_indirect_objects</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">obj</span>, <span class="ruby-identifier">revision</span><span class="ruby-operator">|</span>
331:             <span class="ruby-identifier">build</span>(<span class="ruby-identifier">obj</span>, <span class="ruby-identifier">revision</span>)          
332:         }
333:         
334:         <span class="ruby-keyword kw">self</span>
335:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>